package com.threadLocal;

import java.text.SimpleDateFormat;
import java.time.Instant;
import java.time.temporal.TemporalField;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;
import java.util.logging.SimpleFormatter;

/**
 * Created by huangyugen on 2019/05/08
 **/
public class NumberManage {
    private static NumberManage numer = null;

    public static NumberManage openConnection() {
        if (numer == null) {
            numer = new NumberManage();
        }
        return numer;
    }

    public static void closeConnection() {
        if (numer != null)
            numer = null;
    }

    public static void main(String[] args) {
//        ThreadLocal<Calendar> calendarThreadLocal = new ThreadLocal<Calendar>();
//        Calendar calendar = Calendar.getInstance();
//        calendarThreadLocal.set(calendar);
//        calendar.setTimeInMillis(1608998400000L);
//        calendar.add(Calendar.DATE,-360);
//        SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//        System.out.println(sf.format(calendar.getTime()));

//        List<String> list = Arrays.asList("1", "2", "3");
//        list.add("4");//抛出异常
//        for (String temp:list){
//            System.out.println(temp);
//        }



    }
}
